home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / imlib / include / morph.hpp < prev    next >
C/C++ Source or Header  |  1996-04-11  |  3KB  |  103 lines

  1. #ifndef __MORPH_HPP_
  2. #define __MORPH_HPP_
  3.  
  4. #include <stdio.h>
  5. #include "image.hpp"
  6. #include "palette.hpp"
  7. #include "macs.hpp"
  8. #include "monoprnt.hpp"
  9. #include "specs.hpp"
  10. #include "filter.hpp"
  11. #include "jmalloc.hpp"
  12.  
  13.  
  14. struct morph_point8
  15.   unsigned char x1,y1,x2,y2;
  16.   unsigned char start_color,end_color;
  17. } ;
  18.  
  19. struct morph_point16
  20.   unsigned short x1,y1,x2,y2;
  21.   unsigned char start_color,end_color;
  22. } ;
  23.  
  24. struct morph_patch                // patch a frame of animation
  25. {
  26.   unsigned short patches;
  27.   unsigned char *patch_data;       // x,y,color
  28. } ;
  29.  
  30. class jmorph
  31. {
  32. protected :
  33.   unsigned char small;
  34.   void *p;                  // points to a 8 or 16 struct
  35.   long total; 
  36.   unsigned short w[2],h[2];
  37. public : 
  38.   int total_points() { return total; }
  39.   morph_point8 *small_points() { return (morph_point8 *)p; }
  40.   jmorph(spec_entry *e, FILE *fp);
  41.   jmorph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps);
  42.   void show_frame(image *screen, int x, int y, int frames, int frame_on, 
  43.              color_filter *fli, palette *pal); 
  44.   void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 
  45.   void show_24frame(unsigned char *screen, int width, int height,
  46.                     int x, int y, int frames, int frame_on, palette *pal); 
  47.   void show_step_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
  48.   int bound_x1(int which) { return 0; }
  49.   int bound_y1(int which) { return 0; }
  50.   int bound_x2(int which) { return w[which]; }
  51.   int bound_y2(int which) { return h[which]; }
  52.   int write(FILE *fp);
  53.   void add_filler(int frames);
  54.   int small_morph() { return small; }
  55.   ~jmorph() { jfree(p); }
  56. } ; 
  57.  
  58.  
  59.  
  60. class patched_morph : public jmorph
  61. {
  62. public :
  63.   morph_patch *pats;
  64.   unsigned short patches;
  65.   patched_morph(spec_entry *e, FILE *fp);
  66.   patched_morph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps,
  67.             color_filter *fli, palette *pal, int frames);
  68.   void show_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 
  69.   void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 
  70.   ~patched_morph() { jfree(pats); }
  71.  
  72. } ;
  73.  
  74. struct step_struct
  75. {
  76.   unsigned short x,y,r,g,b;
  77.   short dx,dy,dr,dg,db;
  78. } ;
  79.  
  80. class step_morph
  81. {
  82.   int total;
  83.   step_struct *points;
  84.   int frame_on,dir,face_dir;
  85.   patched_morph *pm;
  86. public :
  87.   step_morph(patched_morph *mor, palette *pal, int frame_direction, int face_direction);
  88.   void show_frame(image *screen, int x, int y,  color_filter *fli); 
  89.   void reverse_direction();
  90.   ~step_morph() { jfree(points); }
  91. } ;
  92.  
  93.  
  94. #endif
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.